package practice;

import java.util.*;

public class practice01 {

    /**
     * 两个数组的交集
     * @param nums1
     * @param nums2
     * @return
     */
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        boolean[] hash = new boolean[1010];
        // 将nums1中的值添加进hash表
        for (int x : nums1) {
            hash[x] = true;
        }
        ArrayList<Integer> list = new ArrayList<>();
        for (int x : nums2) {
            if (hash[x] == true) {
                list.add(x);
                hash[x] = false;
            }
        }
        return list;
    }


    /**
     * 点击消除
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s =in.next().toCharArray();
        StringBuilder st = new StringBuilder();
        for (int i = 0; i < s.length; i++) {
            char ch = s[i];
            if (st.length() != 0 && st.charAt(st.length() - 1) == ch) {
                // 出栈
                st.deleteCharAt(st.length() - 1);
            } else {
                // 进栈
                st.append(ch);
            }
        }
        System.out.println(st.length() == 0 ? 0 : st.toString());
    }


    /**
     * 数字统计
     * @param args
     */
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        int r = in.nextInt();
        int count = 0;
        for (int i = l; i <= r; i++) {
            int tmp = i;
            while (tmp != 0) {
                if (tmp % 10 == 2) count++;
                tmp /= 10;
            }
        }
        System.out.println(count);
    }

}
